// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 

package com.nnee.p_p.p_a;

import java.io.FilterOutputStream;
import java.io.IOException;
import java.io.OutputStream;

// Referenced classes of package com.nnee.p.a:
//            a

public class cls_b extends  FilterOutputStream
{

    public cls_b(OutputStream outputstream)
    {
        this(outputstream, true);
    }

    public cls_b(OutputStream outputstream, boolean flag)
    {
        super(outputstream);
        c = new byte[1];
        a = flag;
        b = new cls_a();
    }

    public cls_b(OutputStream outputstream, boolean flag, int i, byte abyte0[])
    {
        super(outputstream);
        c = new byte[1];
        a = flag;
        b = new cls_a(i, abyte0);
    }

    private void a(boolean flag)
    {
        int i = b.b();
        if(i > 0)
        {
            byte abyte0[] = new byte[i];
            int j = b.a(abyte0, 0, i);
            if(j > 0)
				try {
					out.write(abyte0, 0, j);
				} catch (IOException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
        }
        if(flag)
			try {
				out.flush();
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
    }

    public void close()
    {
        if(a)
            b.c(c, 0, -1);
        else
            b.d(c, 0, -1);
        flush();
    }

    public void flush()
    {
        a(true);
    }

    public void write(int i)
    {
        c[0] = (byte)i;
        write(c, 0, 1);
    }

    public void write(byte abyte0[], int i, int j)
    {
        if(abyte0 == null)
            throw new NullPointerException();
        if(i < 0 || j < 0 || i + j < 0)
            throw new IndexOutOfBoundsException();
        if(i > abyte0.length || i + j > abyte0.length)
            throw new IndexOutOfBoundsException();
        if(j > 0)
        {
            if(a)
                b.c(abyte0, i, j);
            else
                b.d(abyte0, i, j);
            a(false);
        }
    }

    private final boolean a;
    private final cls_a b;
    private final byte c[];
}
